#include "stdafx.h"
#include "Define.h"

BOOL CharToWChar(WCHAR *pOut, CHAR* tTempValue)
{
	size_t tOrigSize = strlen(tTempValue) + 1;
	size_t tConvertedSize = 0;

	mbstowcs_s(&tConvertedSize, pOut, tOrigSize, tTempValue, _TRUNCATE);

	return TRUE;
}

BOOL WCharToChar(CHAR *pOut, WCHAR* tTempValue)
{
	size_t tOrigSize = lstrlenW(tTempValue) + 1;
	size_t tConvertedSize = 0;

	wcstombs_s(&tConvertedSize, pOut, tOrigSize, tTempValue, _TRUNCATE);

	return TRUE;
}

BOOL FloatToString(WCHAR* pOut, const FLOAT pValue)
{
	swprintf(pOut, 15, L"%.3f", pValue);

	return TRUE;
}

BOOL IsInRect( RECT* rc, POINT pt )
{
	if( ( rc->left <= pt.x ) && ( pt.x <= rc->right ) &&
		( rc->bottom <= pt.y ) && ( pt.y <= rc->top ) )
		return TRUE;

	return FALSE;
}

DWORD FtoDw(FLOAT f)
{
	return *((DWORD*)&f);
}